#include <iostream>
#include <map>
#include <math.h>
#include <string.h>
using namespace std;


struct edge{
	int x,y,x_next,y_next;
//	bool operator < (const edge a)const{
//		return true;
//	}
};


int find(int x,int *f){
	if(x == f[x])
		return x;
	return f[x]=find(f[x],f);
}


int main(){
	int n,m,num;
	cin>>n>>m;
	int f[n];
	bool bra[n];
	int e_head[n];
	edge e[m];
	memset(e_head,-1,sizeof(e_head));
	memset(bra,false,sizeof(bra));
//	map<edge,int> mp1;
//	map<int,edge> mp2;
	for(int i=0;i<n;i++)
		f[i] = i;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		e[i].x = x;
		e[i].y = y;
		e[i].x_next = e_head[x];
		e[i].y_next = e_head[y];
		e_head[x] = e_head[y] = i;
	}
	int k;
	cin>>k;
	num = n-k;
	int aim[k],ans[k+1];
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		bra[x] = true;
		aim[i] = x;
	}
	for(int i=0;i<m;i++){
//		if(bra[i])
//			continue;
//		int head=e_head[i];
//		while(head != -1){
//			int fx=find(e[head].x,f),fy=find(e[head].y,f);
//			if(fx != fy){
//				num--;
//				f[fx] = fy;
//			}
//			head = i==e[head].x?e[head].x_next:e[head].y_next;
//		}
//		cout<<num<<endl;
		if(bra[e[i].x]  ||  bra[e[i].y])
			continue;
		int fx=find(e[i].x,f),fy=find(e[i].y,f);
		if(fx != fy){
			num--;
			f[fx] = fy;
		}
//		cout<<e[i].x<<" "<<e[i].y<<" "<<num<<endl;
	}
	ans[k] = num;
	for(int i=k-1;i>=0;i--){
		num++;
		int head = e_head[aim[i]];
		bra[aim[i]] = false;
		while(head != -1){
			int x=e[head].x,y=e[head].y;
			if(bra[x]  ||  bra[y]){
				head = aim[i]==e[head].x?e[head].x_next:e[head].y_next;
				continue;
			}
			int fx=find(x,f),fy=find(y,f);
			if(fx != fy){
				num--;
				f[fx] = fy;
//				cout<<x<<" "<<y<<endl;
			}
			head = aim[i]==e[head].x?e[head].x_next:e[head].y_next;
		}
		ans[i] = num;
	}
	for(int i=0;i<=k;i++)
		cout<<ans[i]<<endl;
	return 0;
}
